﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Windows.Controls.Ribbon;
using Puzzler.Plugin;
using Puzzler.Plugin.Interface;
using Puzzler.Project;
using NET.Tools;

namespace Puzzler.GUI
{
    public partial class MainWindowResources : ResourceDictionary
    {
        private void Puzzle_Click(object sender, RoutedEventArgs e)
        {
            var pluginObject = ((sender as RibbonButton).Tag as PluginObject);
            PuzzleData data = WizardBuilder.Build(pluginObject.WizardXml).ShowWizard();
            if (data != null)
            {
                IPuzzlePlugin puzzlePlugin = pluginObject.CreatePluginInstance();
                puzzlePlugin.Update(data);
                PuzzlerProjectService.AddInstance(pluginObject, puzzlePlugin);
            }

            e.Handled = true;
        }
    }
}
